const BASE_URL = 'http://123.207.32.32:9001'

class requestInstance {
  request(url, method, data) {
    return new Promise((resolve, reject) => {
      wx.request({
        url: BASE_URL + url, //仅为示例，并非真实的接口地址
        method,
        data,
        success (res) {
          resolve(res.data)
        },
        fail(err) {
          reject(err)
        }
      })
    })
  }
  
  get(url, data) {
    return this.request(url, 'GET', data)
  }

  post(url, data) {
    return this.request(url, 'POST', data)
  }
}

const request = new requestInstance()

export default request
